package 链表算法题;

public class 翻滚链表 {
    public class ListNode{
        int val;
        ListNode next = null;
        ListNode(int val){
            this.val = val;

        }
    }

    public ListNode ReverseList(ListNode head){
         ListNode next = null;
         ListNode pre = null;

         while (head!=null){
             
             next = head.next;

             head.next = pre;

             pre = head;

             head= next;
         }


return pre;

    }

}
